<template>
  <el-form :inline="true" :model="temp" ref="form" :rules="rules" label-width="100px" label-position="right"
           class="menu__edit__form">
    <el-row class="menu__edit__form__row">
      <el-form-item label="菜单标题" prop="title">
        <el-input size="small" v-model="temp.title"></el-input>
      </el-form-item>
      <el-form-item label="访问路径" prop="path">
        <el-input size="small" v-model="temp.path"></el-input>
      </el-form-item>
    </el-row>
    <el-row class="menu__edit__form__row">
      <el-form-item label="组件名称" prop="component">
        <el-input size="small" v-model="temp.component"></el-input>
      </el-form-item>
      <el-form-item label="排序">
        <el-input size="small" v-model.number="temp.orderNum"></el-input>
      </el-form-item>
    </el-row>
    <el-row class="menu__edit__form__row">
      <el-form-item label="图标">
        <el-input size="small" v-model="temp.icon"></el-input>
      </el-form-item>
      <el-form-item label="菜单级别">
        <el-input size="small" v-model="temp.level" disabled></el-input>
      </el-form-item>
    </el-row>
    <el-row class="menu__edit__form__row">
      <el-form-item label="描述">
        <el-input size="small" type="textarea" v-model="temp.noteDesc"></el-input>
      </el-form-item>
    </el-row>
  </el-form>
</template>

<script>
import TempMixin from "@/mixins/TempMixin";

export default {
  mixins: [TempMixin],
  data() {
    return {
      rules: {
        title: [
          {required: true, message: '请输入菜单标题', trigger: 'blur'},
        ],
        path: [
          {required: true, message: '请输入菜单标题', trigger: 'blur'},
        ],
        component: [
          {required: true, message: '请输入菜单标题', trigger: 'blur'},
        ],
      }
    }
  }
  ,
  component: {}
  ,
  computed: {}
  ,
  watch: {}
  ,
  methods: {
    validate(cbk) {
      this.$refs.form.validate((validate) => {
        if (validate) {
          cbk()
        }
      })
    }
  }
}
</script>

<style lang="scss">
.menu__edit__form {
  &__row {
    display: flex;
    justify-content: space-between;

    .el-form-item {
      width: 100%;

      &__content {
        width: calc(100% - 100px);
      }
    }
  }
}
</style>
